package com.lmk.t01;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class OutputStreamText {
    public static void main(String[] args) {
        String  path="D:/11/b.txt";
        //1.创建文件对象
        File file=new File(path);
        //2.定义输出流
        try(OutputStream ous=new FileOutputStream(file,true)) {
            String content="明天吃土";
            byte[] bytes=content.getBytes(StandardCharsets.UTF_8);
            ous.write(bytes);
            ous.flush();//刷新缓存
        }  catch (Exception e) {
            e.printStackTrace();
        }

    }
}
